﻿<%@ Page Language="C#" MasterPageFile="~/Manage/MainPage.master"  AutoEventWireup="true" CodeFile="PurviewResourceManage.aspx.cs" Inherits="Manage_PurviewResourceManage" %>
<%@ Import Namespace="Shopping.Common" %>
<%@ Import Namespace="Shopping.Model" %>
<%@ Import Namespace="Shopping.BLL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
<script type="text/javascript" src="/Manage/Js/PurviewResourceManage.js"></script>
<script type="text/javascript">
    SelectOptionOfGroups = '<%=PurviewResourceManage.GetGroupsToSelectOption(false,"") %>';
    ModelOfRes =<%=new PurviewResources().ToJsonString() %> ;
    CheckOptionOfOperates ='<%=CheckOptionOfOperates %>';
    ResourceEnumString = '<%=ResourceEnumString %>';
</script>

<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table">
     <tr >
    
    <td align="center" class="TableHeadRow">所属分组</td>
    <td align="left" class="TableHeadRow">菜单资源名称</td>
    <td align="center" class="TableHeadRow">排序值</td>
    <td align="center" class="TableHeadRow">建立日期</td>
    <td align="center" class="TableHeadRow">状态</td>
    <td align="center" class="TableHeadRow">操作
    [<a href="javascript:void(0);" onclick="Add();" class="red">添加资源</a>]
    [<a href="javascript:void(0);" onclick="GenerateResEnum();"><font color="red"><b>生成资源枚举</b></font></a>]
    </td>
  </tr>
  
  <%
      if (listOfRes != null)
      {
          int i = 0;
          int GroupItems = 0;
          bool IsStartNewGroup = false;
          foreach (ResourceInfo res in listOfRes)
          {
              if (i == 0 || (i > 0 && res.GroupInfo.ID != listOfRes[i - 1].GroupInfo.ID))
              {
                  IsStartNewGroup = true;
                  GroupItems = 0;
                  for (int j = i; j < listOfRes.Count; ++j)
                  {
                      if (listOfRes[j].GroupInfo.ID == res.GroupInfo.ID)
                      {
                          GroupItems++;
                      }
                  }
              }
              else
              {
                  IsStartNewGroup = false;
              }
              i++;
             
   %>
    <tr  onmouseover="this.style.backgroundColor='#F2F2F2';" onmouseout="this.style.backgroundColor='#FFFFFF';" >
    
    
    <%if (IsStartNewGroup)
      {
           %>
    <td width="9%" align="center"  rowspan="<%=GroupItems %>" bgcolor="#FFFFFF" ><font color="blue"><b><%=res.GroupInfo.Name%></b></font></td>
    <% } %>
    <td width="41%" align="left"  bgcolor="" >&nbsp;<img src="/Manage/images/arrow-item.gif" border="0" /> <a href="javascript:void(0);" onclick="Edit(<%=res.Res.PurviewResourceID %>)" title="访问地址：<%=res.Res.ResourceUrl %>
是否在菜单显示：<%=res.Res.IsInMenuTree%>"><%=res.Res.ResourceName%></a>
     [ID=<%=res.Res.PurviewResourceID%>]
    &nbsp;  
    
    
    <%
        if (!res.Res.IsInMenuTree)
        {
            Response.Write(" <font color=red>不在菜单显示</font>");
        }
       %>   
       
       
       
         </td>
    <td width="7%" align="center"  ><%=res.Res.OrderValue%></td>
    <td width="17%" align="center"  ><%=res.Res.CreateDate.ToString("yyy-MM-dd HH:mm:ss")%></td>
    <td width="7%" align="center"  ><%=res.Res.Status%></td>
    <td width="19%" align="center"  >[<a href="javascript:void(0);" onclick="Edit(<%=res.Res.PurviewResourceID %>)">编辑菜单信息</a>] [<a href="javascript:void(0);" onclick="Delete(<%=res.Res.PurviewResourceID %>);" class="red">删除</a>]</td>
    </tr>
    
    
    
   <%    }
      }
      else
      {  
     %> 
    
    <tr>
      <td  colspan="6"   align="center">[ <font color=red>未找到任何菜单资源记录</font> ]</td>
    </tr>
    <% } %>

  <tr>
  <td colspan="6" align="center"><input type="button" name="btnAddRes" id="btnAddRes" value="增加新菜单" class="btn2" onclick="Add();"  /> &nbsp;</td>
  </tr>
    </table>


</asp:Content>